var isIE=(document.all&&document.getElementById&&!window.opera)?true:false; 
var isMozilla=(!document.all&&document.getElementById&&!window.opera)?true:false; 
var isOpera=(window.opera)?true:false;
var seturl='url(#default#homepage)';
var weburl=window.location.href;
var webname=document.title;

function myhomepage() {
if(isMozilla){
   try {netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");} 
   catch (e){alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");}
   var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
   prefs.setCharPref('browser.startup.homepage',weburl);
}
if(isIE){
   this.homepage.style.behavior=seturl;this.homepage.sethomepage(weburl); 
}
}

function addfavorite()
{

if(isMozilla){
   if (document.all){ window.external.addFavorite(weburl,webname);}
   else if (window.sidebar){ window.sidebar.addPanel(webname, weburl,"");}
}
if(isIE){window.external.AddFavorite(weburl, webname);} 
}